# $Id$
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=libdbusmenu-qt
pkgname=(libdbusmenu-qt4 libdbusmenu-qt5)
pkgver=0.9.3+16.04.20160218
pkgrel=1
pkgdesc="A library that provides a Qt implementation of the DBusMenu spec"
arch=(i686 x86_64)
url="https://launchpad.net/libdbusmenu-qt"
license=(GPL)
makedepends=(cmake doxygen qjson qt4 qt5-base)
source=("http://archive.ubuntu.com/ubuntu/pool/main/libd/$pkgbase/${pkgbase}_$pkgver.orig.tar.gz")
md5sums=('8b90312bd8654e026d814d4db986ce5e')

prepare() {
  mkdir -p build{-qt4,}
}

build() {
  cd build
  cmake ../$pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_LIBDIR=lib
  make

  cd ../build-qt4
  cmake ../$pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DUSE_QT4=On
  make  
}

package_libdbusmenu-qt4() {
  pkgdesc="A library that provides a Qt4 implementation of the DBusMenu spec"
  depends=(qt4)
  conflicts=(libdbusmenu-qt)
  provides=(libdbusmenu-qt)
  replaces=(libdbusmenu-qt)

  cd build-qt4
  make DESTDIR="$pkgdir" install
}

package_libdbusmenu-qt5() {
  depends=(qt5-base)

  cd build
  make DESTDIR="$pkgdir" install
}
